/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package lab3serveurhttp;

import java.net.ServerSocket;
import java.net.Socket;

/**
 *
 * @author aj48640
 */
public class HTTPServer
{
    private ServerSocket socket;
    private boolean started = false;

    public HTTPServer (int port) throws Exception
    {
        socket = new ServerSocket(port);
    }

    public void StartServer() throws Exception
    {

        started=true;

        while (started)
        {
            Socket clientSocket = socket.accept();
            System.out.println ( "Nouvelle connexion : " + clientSocket.getInetAddress().getHostAddress() + ":" + clientSocket.getPort());
            new Thread(new HTTPConnectionHandler(clientSocket)).start();
        }
    }
}
